package com.sinosoft.zyxt.task;

import java.util.Calendar;
import java.util.Date;
import java.util.Timer;

public class MbimgTimeManager {

	
	
	  private static final long PERIOD_DAY = 24 * 60 * 60 * 1000;

		public MbimgTimeManager() {
			
			Calendar calendar = Calendar.getInstance();

			calendar.set(Calendar.HOUR_OF_DAY,16);

			calendar.set(Calendar.MINUTE,38);

			calendar.set(Calendar.SECOND,0);

			Date date=calendar.getTime();

			if (date.before(new Date())) {

			date = this.addDay(date, 1);

			}

			Timer timer = new Timer();

			MbimgTimerTask task = new MbimgTimerTask();

		    timer.schedule(task, date,PERIOD_DAY);
		}
		
		
	public Date addDay(Date date,int num) {
		Calendar starDt = Calendar.getInstance();
		starDt.setTime(date);
		starDt.add(Calendar.DAY_OF_MONTH,num);
		return starDt.getTime();
	}

		

}
